Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 8 Forum

Notes/Domino 8 Forum

Previous Next

souce code


// 3.1 initial create user parameter
try {
reg = genConf.session.createRegistration();
reg.setRegistrationServer(genConf.SMDServer); //set registeration server
reg.setCertifierIDFile(genConf.cert_path); //set cert.id location
reg.setCreateMailDb(true);
DateTime dt = genConf.session.createDateTime("Today");
dt.setNow();
dt.adjustYear(1);
reg.setExpiration(dt); //set expiration:1 year
reg.setIDType(Registration.ID_HIERARCHICAL);
reg.setMinPasswordLength(5); // password strength
reg.setNorthAmerican(true);
reg.setRegistrationLog("log.nsf");
reg.setUpdateAddressBook(true);
reg.setStoreIDInAddressBook(true);
} catch (NotesException e1) {
e1.printStackTrace();
}

// 3.2 create user
for(int i=0;i<4;i++) {

// frist check if user exist
StringBuffer mailserver = new StringBuffer();
StringBuffer mailfile = new StringBuffer();
StringBuffer maildomain = new StringBuffer();
StringBuffer mailsystem = new StringBuffer();
Vector profile = new Vector();
strUser= strUserList[i];
//check if user exist
debugLog.record(DebugLog.HIGH, "check if user exist \t" +strUser+" ......");
try {
reg.getUserInfo(strUser,
mailserver,
mailfile,
maildomain,
mailsystem,
profile);
} catch (NotesException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// print user's information
debugLog.record(DebugLog.HIGH, "Info for " + strUser + "\n" +
"\tMail server:\t" + mailserver + "\n" +
"\tMail file:\t\t" + mailfile + "\n" +
"\tMail domain:\t" + maildomain + "\n" +
"\tMail system:\t" + mailsystem + "\n" +
"\tProfile:");
for (int n=0; n<profile.size(); n++) {
debugLog.record(DebugLog.HIGH, profile.elementAt(n).toString());
}

// frist check if user exist , exist skip
if( mailfile.length()!=0 )
{
debugLog.record(DebugLog.HIGH, strUser+"is exist");
}
// frist check if user exist ,if not create user and add acl
else
{
//if not exist register a new user
debugLog.record(DebugLog.HIGH, strUser+"is not exist");
debugLog.record(DebugLog.HIGH, "registering user\t" +strUser+" ......");
try {
if (reg.registerNewUser(strUser, // last name
genConf.localpath+strUser+".id", // file to be created /localdata/user.id
genConf.SMDServer, // mail server
"", // first name
"", // middle initial
genConf.cert_pwd, // certifier password
"", // location field
"", // comment field
"mail\\"+strUser+".nsf", // mail file
"", // forwarding domain
genConf.user_pwd)) //user password
{
debugLog.record(DebugLog.HIGH, "user("+strUser+") is created successfully");
}
else
{
debugLog.record(DebugLog.HIGH, "failed to create user("+strUser+")");
}

try {
Thread.sleep(10000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}catch(NotesException e) {
e.printStackTrace();
}
}
}
//in the end switch id back to admin's id

debugLog.record(DebugLog.HIGH, "-------------create users and add ACL success-------------");
System.out.println("-------------create users and add ACL success-------------");
}
}


Feedback response number WEBB7GS84J created by ~Juan Zekfreeverakol on 07/22/2008

java api create user (~Juan Zekfreeve... 21.Jul.08)
. . a wild guess (~Karl Froresaze... 21.Jul.08)
. . souce code (~Juan Zekfreeve... 22.Jul.08)
. . . . use admin access to domino (~Juan Zekfreeve... 22.Jul.08)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS